package com.gamificationlibrary.model;
import java.io.Serializable;
import java.util.ArrayList;

import com.gamificationlibrary.model.Area;
import com.gamificationlibrary.model.Score;
import com.gamificationlibrary.model.levels.Level;


public abstract class Player implements Serializable{
	
	/**
	 * 
	 */
	
	private static final long serialVersionUID = 7104175545982448759L;
	private Score scoreTotal;
	private Level level;
	private int rank;
	private ArrayList<Score> temporalScore;
	private ArrayList<Score> geographicalScore;
	private ArrayList<Score> geoTemporalScore;
	
	public Player()
	{
		level=null;
		rank=0;
		scoreTotal=new Score();
		temporalScore=new ArrayList<Score>();
		geographicalScore=new ArrayList<Score>();
		geoTemporalScore=new ArrayList<Score>();
	}
	
    public ArrayList<Score> getGeoTemporalScore() {
		return geoTemporalScore;
	}

    public void setGeoTemporalScore(ArrayList<Score> geoTemporalScore) {
		this.geoTemporalScore = geoTemporalScore;
	}

	public void setTemporalScore(ArrayList<Score> temporalScore) {
		this.temporalScore = temporalScore;
	}

	public void setGeographicalScore(ArrayList<Score> geoScore) {
		this.geographicalScore = geoScore;
	}
	
	public Score getScoreTotal() {
		return scoreTotal;
	}

	public void setScoreTotal(Score total) {
		this.scoreTotal = total;
	}
	
	
	public Score getTemporalScore(int numDays)
	{
		// TODO Auto-generated method stub
				for(int i=0;i<temporalScore.size();i++)
				{
					if( (temporalScore.get(i)).getNumDays()==numDays)
					{
						return temporalScore.get(i);
					}
				}
				
				return null;
	}
	
	public Score getGeographicalScore(Area area)
	{
		for(int i=0;i<geographicalScore.size();i++)
		{
			if( (geographicalScore.get(i)).getArea().getName().equals(area.getName()))
			{
				return geographicalScore.get(i);
			}
		}
		
		return null;
	}
	
	public Score getGeoTemporalScore(int numDays, Area area)
	{
		for(int i=0;i<geoTemporalScore.size();i++)
		{
			if( (geoTemporalScore.get(i)).getArea().getName().equals(area.getName()) && (geoTemporalScore.get(i)).getNumDays()==numDays)
			{
				return geoTemporalScore.get(i);
			}
		}
	
		return null;
	}
	
	public abstract String getIdentification();
	
   
	public Level getLevel() {
		return level;
	}

	public void setLevel(Level level) {
		this.level = level;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}
    

}
